import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public abstract class BankCard 
{
  String cardNo;   // 卡号
  String cardDate; // 开卡时间
  public BankCard(String cardNo, String cardDate) 
  {
    this.cardNo = cardNo;
    this.cardDate = cardDate;
  }
  public String getCardNo() 
  {
    return(this.cardNo);
  }
  public String getCardDate()
  {
    return(this.cardDate);
  }

  abstract boolean rule(BigDecimal amount);

  Logger logger = Logger.getLogger(BankCard.class.getName());

  // 正向入账，+ 钱
  protected String positive(String orderId, BigDecimal amount) 
  {
    // 入款成功，存款、还款
    this.logger.info("卡号" + this.cardNo + "入款成功，单号：" + orderId + " 金额：" + amount);
    return "0000";
  }

  // 逆向入账，- 钱
  protected String negative(String orderId, BigDecimal amount) 
  {
    // 入款成功，存款、还款
    this.logger.info("卡号" + this.cardNo + " 出款成功，单号：" + orderId + " 金额：" + amount);
    return "0000";
  }

  /**
   * 交易流水查询
   *
   * @return 交易流水
   */
  public List<String> tradeFlow() 
  {
    this.logger.info("交易流水查询成功");
    List<String> tradeList = new ArrayList<String>();
    {
      tradeList.add("100001,100.00");
      tradeList.add("100001,80.00");
      tradeList.add("100001,76.50");
      tradeList.add("100001,126.00");
    }
    return tradeList;
  }
}
